package com.itheima.service.impl;

import com.itheima.dao.AccountDao;
import com.itheima.domain.Account;
import com.itheima.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * @Author 王加鑫
 * @Date 2021/08/04 17:13
 * @Since JDK 1.8
 */
@Service
public class AccountServiceImpl implements AccountService {

    @Autowired
    private AccountDao dao;

    @Override
    public void save(Account account) {
        dao.save(account);
    }

    @Override
    public void update(Account account) {
        dao.update(account);
    }

    @Override
    public void delete(Integer id) {
        dao.delete(id);
    }

    @Override
    public Account findById(Integer id) {
        return dao.findById(id);
    }

    @Override
    public List<Account> findAll() {
        return dao.findAll();
    }

    @Override
    public void transfer(Double money, Integer id1, Integer id2){
        dao.payment(money,id1);
        int  i = 10 / 0;
/*        String s = null;
        int length = s.length();*/
        dao.collection(money,id2);

    }
}
